import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common';
import { UserlogService } from './userlog.service';
import { CreateUserlogDto } from './dto/create-userlog.dto';
import { UpdateUserlogDto } from './dto/update-userlog.dto';
import { JwtAuthGuard } from 'src/core/system/auth/guard/jwt-auth.guard';
import { PoliciesGuard } from 'src/common/guard/casl.guard';

@Controller('userlog')
export class UserlogController {
  constructor(private readonly userlogService: UserlogService) {}

  @Post()
  create(@Body() createUserlogDto: CreateUserlogDto) {
    return this.userlogService.create(createUserlogDto);
  }

  @UseGuards(JwtAuthGuard,PoliciesGuard)  //权限守卫
  @Get()
  findAll() {
    return {test:'test'}
    // return this.userlogService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.userlogService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateUserlogDto: UpdateUserlogDto) {
    return this.userlogService.update(+id, updateUserlogDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.userlogService.remove(+id);
  }
}
